package com.gadgetscode.mazeboy;

import java.util.ArrayList;

public class GameTimer {
	
	private ArrayList<Star> stars;
	private int totaltime;
	private boolean ingame;
	private LostLabel ll;
	
	public GameTimer(ArrayList<Star> stars, LostLabel ll) {
		this.stars = stars;
		this.ll = ll;
	}
	
	public void tick() {
		totaltime -= 1000;
	}
	
	public void removeStar() {
		if(!stars.isEmpty()) {
			if(totaltime == 9000000) {
				stars.remove(0);
			}
			else if(totaltime == 8000000) {
				stars.remove(0);
			}
			else if(totaltime == 7000000) {
				stars.remove(0);
			}
			else if(totaltime == 6000000) {
				stars.remove(0);
			}
			else if(totaltime == 7000000) {
				stars.remove(0);
			}
			else if(totaltime == 6000000) {
				stars.remove(0);
			} 
			else if(totaltime == 5000000) {
				stars.remove(0);
			} 
			else if(totaltime == 4000000) {
				stars.remove(0);
			} 
			else if(totaltime == 3000000) {
				stars.remove(0);
			} 
			else if(totaltime == 2000000) {
				stars.remove(0);
			} else if(totaltime == 1000000) {
				stars.remove(0);
			} else if (totaltime < 500000) {
				stars.remove(0);
				ingame = false;
				ll.setVisible(true);
			}
		}
	}
	
	public boolean inGame() {
		return ingame;
	}

	public void reset() {
		totaltime = 10000000;
		ingame = true;
	}

}